function useridVerification(t) {
    var spanuinfo = document.getElementById("spanuinfo");
    var info = t.value;

    if (info == null || info == "" || info == undefined) {
        spanuinfo.innerHTML = "帐号不能为空。";
    } else if (info.match("^[A-z]{1,3}[0-9]+")) {
        spanuinfo.innerHTML = "帐号不能是1-3位字母+数字的形式。";
    } else if (info.match("^[A-z]$") || info.match("^[0-9]$")) {
        spanuinfo.innerHTML = "账号已被注册";
    } else if (!info.match("^[A-z0-9]")) {
        spanuinfo.innerHTML = "帐号应以数字或字母开头。";
    } else if (info.match("[^A-z0-9-_.]")) {
        spanuinfo.innerHTML = "只能包含字母、数字或 -/_/.";
    } else if (info.length > 50) {
        spanuinfo.innerHTML = "帐号长度不能大于50位。";
    } else {
        spanuinfo.innerHTML = "";
        var img = document.createElement("img");
        spanuinfo.appendChild(img);
        img.src = "../img/icons_right.png";
    }
}



/**
 *邮箱有效性验证
 *
 */
function emailVerification(t) {
    var email = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    var spanmailinfo = document.getElementById("spanmailinfo");
    var val = t.value;
    var str = val.replace(/\s*/g, "");
    console.log(str);
    if (val == "") {
        spanmailinfo.innerHTML = "电子邮箱不能为空。";
    } else {
        spanmailinfo.innerHTML = "";
        if (email.test(val)) {
            var img = document.createElement("img");
            spanmailinfo.appendChild(img);
            img.src = "../img/icons_right.png";
        } else {
            spanmailinfo.innerHTML = "电子邮箱格式无效。";
            t.value = str;
        }
    }
}

/**
 *姓有效性验证
 *
 */
function checkSurName(t) {
    var kongge = /^\s{1,}$/;
    var kongge1 = /\s{1,}\w{1,}/;
    var spansurnameinfo = document.getElementById("spansurnameinfo");
    var val = t.value;
    if (val == "") {
        spansurnameinfo.innerHTML = "姓氏拼音不能为空。";
    } else {
        spansurnameinfo.innerHTML = "";
        if (kongge.test(val)) {
            spansurnameinfo.innerHTML = "姓氏拼音不能为空。";

        } else {
            spansurnameinfo.innerHTML = "";
            if (kongge1.test(val)) {
                spansurnameinfo.innerHTML = "姓氏拼音格式无效。";
            } else {
                spansurnameinfo.innerHTML = "";
                var img = document.createElement("img");
                spansurnameinfo.appendChild(img);
                img.src = "../img/icons_right.png";
            }
        }

    }
}

/**
 *名有效性验证
 *
 */
function checkGivenName(t) {
    var kongge = /^\s{1,}$/;
    var kongge1 = /\s{1,}\w{1,}/;
    var spangivennameinfo = document.getElementById("spangivennameinfo");
    var val = t.value;
    if (val == "") {
        spangivennameinfo.innerHTML = "名字拼音不能为空。";
    } else {
        spangivennameinfo.innerHTML = "";
        if (kongge.test(val)) {
            spangivennameinfo.innerHTML = "名字拼音不能为空。";

        } else {
            spangivennameinfo.innerHTML = "";
            if (kongge1.test(val)) {
                spangivennameinfo.innerHTML = "名字拼音格式无效。";
            } else {
                spangivennameinfo.innerHTML = "";
                var img = document.createElement("img");
                spangivennameinfo.appendChild(img);
                img.src = "../img/icons_right.png";
            }
        }

    }
}


var smsVerificationbl = false;
var num = 1;
function checkbox(t) {
    var p = /^\d{1,30}$/
    var spanofficephoneinfo = document.getElementById("spanofficephoneinfo");
    var ph = document.getElementById("registerVO.officePhone");
    var smsVerification = document.getElementById("smsVerification");
    var val = ph.value;




    if (val == "") {
        spanofficephoneinfo.innerHTML = "手机号码不能为空。";
        return false;
    } else {
        spanofficephoneinfo.innerHTML = "";
        if (p.test(val)) {
            if (val.length < 6 || val.length > 30) {
                spanofficephoneinfo.innerHTML = "手机号码长度不能小于6且不能大于30。";
                return false;
            } else {
                var img = document.createElement("img");
                spanofficephoneinfo.appendChild(img);
                img.src = "../img/icons_right.png";

                num++;
                // console.log(num);
                if (num == 2) {
                    smsVerificationbl = true;
                }

                if (num == 3) {
                    smsVerificationbl = false;
                    num = 1;
                }


                if (smsVerificationbl) {
                    smsVerification.style.display = "block";
                } else {
                    smsVerification.style.display = "none";
                }
                return true;
            }
        } else {
            spanofficephoneinfo.innerHTML = "手机号码格式无效。";
            return false;
        }
    }
}


function smsVerification(t) {
    var kongge = /\s{1,}\w{1,}/;
    var verifycodeinfo = document.getElementById("verifycodeinfo");
    var val = t.value;

    if (val == "" || !kongge.test(val)) {
        verifycodeinfo.innerHTML = "短信验证码不能为空。";
    } else {
        verifycodeinfo.innerHTML = "";
    }
}